#include "widget.h"
#include "ui_widget.h"

#include<QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    //初始化输入框
    ui->lineEdit_name->setPlaceholderText("请输入姓名");
    ui->lineEdit_name->setClearButtonEnabled(true);

    ui->lineEdit_passward->setPlaceholderText("请输入密码");
    ui->lineEdit_passward->setClearButtonEnabled(true);
    //显示密码的模式
    ui->lineEdit_passward->setEchoMode(QLineEdit::Password);

    ui->lineEdit_phone->setPlaceholderText("请输入手机号码");
    ui->lineEdit_phone->setClearButtonEnabled(true);
    //手机号码固定格式，此时0代表数字
    ui->lineEdit_phone->setInputMask("000-0000-0000");

}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_submit_clicked()
{
    QString gender = ui->radioButton_male->isChecked() ? "男" : "女";

    qDebug() << "姓名:" << ui->lineEdit_name->text()
             << "密码:" << ui->lineEdit_passward->text()
             << "性别:" << gender
             << "电话：" << ui->lineEdit_phone->text();
}
